import QtQuick
import QtQuick.Controls
import QtQuick.Layouts


Rectangle{
    id:detailsView
    width: parent.width
    height: parent.height
    color:"#f8f8f8"

    ColumnLayout{
        anchors.fill: parent
        spacing:5
        //用户信息
        Rectangle{
            id:userRectangle
            Layout.fillWidth:true
            height: 36
            color:"#ffffff"
            Row{
                width: parent.width - 20
                height: parent.height
                x:10
                // y:5
                spacing:30
                TextEdit{
                    text: "数据id：937807991808200704"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
                TextEdit{
                    text: "患者姓名：黄通"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
                TextEdit{
                    text: "患者性别：男"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
                TextEdit{
                    text: "患者年龄：33岁"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
                TextEdit{
                    text: "记录开始时间： 2024-08-30 22:35:43"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
                TextEdit{
                    text: "采集总时长： 21小时50分钟02秒"
                    color:"#333333"
                    font.pixelSize: 14
                    readOnly: true  // 设置为只读，以便只允许选择和复制
                    selectByMouse: true  // 允许通过鼠标选择文本
                    wrapMode: TextEdit.NoWrap  // 不自动换行
                    height: parent.height
                    verticalAlignment: Text.AlignVCenter
                    focus: false
                }
            }
            CustomButton{
                anchors.right: parent.right
                anchors.top: parent.top
                anchors.rightMargin: 10
                anchors.topMargin: 5
                width:80
                height: parent.height-10
                text:"退出"
                // 连接信号和槽
                onButtonClicked: {
                    console.log("Button clicked!")
                }
            }
        }
        //菜单
        Rectangle{
            id:menuRectangle
            color:"#f8f8f8"
            Layout.fillWidth:true
            height: 70
            Row{
                spacing:2
                width: parent.width
                height: parent.height
                //模板
                Rectangle{
                    color: "#ffffff"
                    width: (parent.width-8)*(5.5/20)
                    height: parent.height
                    RowLayout{
                        id:templateRow
                        anchors.centerIn:parent
                        height: parent.height
                        width: templateRow.children.length * 70 + (templateRow.children.length - 1) * templateRow.spacing
                        spacing:2
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Text{
                                width: parent.width
                                height: 37
                                anchors.top: parent.top
                                anchors.topMargin: 8
                                font.pixelSize: 32
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "N"
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "正常模板"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            color: "#ffffff"
                            radius:5
                            Text{
                                width: parent.width
                                height: 37
                                anchors.top: parent.top
                                anchors.topMargin: 8
                                font.pixelSize: 32
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"red"
                                text: "V"
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "室早模板"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            color: "#ffffff"
                            radius:5
                            Text{
                                width: parent.width
                                height: 37
                                anchors.top: parent.top
                                anchors.topMargin: 8
                                font.pixelSize: 32
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"green"
                                text: "S"
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "房早模板"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            color: "#ffffff"
                            radius:5
                            Text{
                                width: parent.width
                                height: 37
                                anchors.top: parent.top
                                anchors.topMargin: 8
                                font.pixelSize: 32
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#999999"
                                text: "X"
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "伪差模板"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            color: "#ffffff"
                            radius:5
                            Text{
                                width: parent.width
                                height: 37
                                anchors.top: parent.top
                                anchors.topMargin: 8
                                font.pixelSize: 32
                                font.bold: true
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#999999"
                                text: "?"
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "疑问模板"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                    }
                }
                //图表
                Rectangle{
                    color: "#ffffff"
                    width: (parent.width-8)*(4.5/20)
                    height: parent.height
                    RowLayout{
                        id:chartRow
                        anchors.centerIn:parent
                        height: parent.height
                        width: chartRow.children.length * 70 + (chartRow.children.length - 1) * chartRow.spacing
                        spacing:2
                        Rectangle{
                            width: 70
                            height: parent.height
                            color: "#fce0cc"
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/sandian.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "散点图"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/xinlv.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "心率图"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/zhifang.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "直方图"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/quancheng.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "全程心电"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                    }
                }
                //事件
                Rectangle{
                    color: "#ffffff"
                    width: (parent.width-8)*(7/20)
                    height: parent.height
                    RowLayout{
                        id:eventRow
                        anchors.centerIn:parent
                        height: parent.height
                        width: eventRow.children.length * 70 + (eventRow.children.length - 1) * eventRow.spacing
                        spacing:2
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 36
                                width: 46
                                anchors.top: parent.top
                                anchors.topMargin: 10
                                source: "qrc:/res/shizaoEvent.png"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "室早事件"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 36
                                width: 46
                                anchors.top: parent.top
                                anchors.topMargin: 10
                                source: "qrc:/res/fangzaoEvent.png"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "房早事件"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 36
                                width: 46
                                anchors.top: parent.top
                                anchors.topMargin: 10
                                source: "qrc:/res/afEvent.png"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "房颤事件"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 36
                                width: 46
                                anchors.top: parent.top
                                anchors.topMargin: 10
                                source: "qrc:/res/tingboEvent.png"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "停搏事件"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 36
                                width: 46
                                anchors.top: parent.top
                                anchors.topMargin: 10
                                source: "qrc:/res/xinlvEvent.png"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "心率异常"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/otherEvent.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "其他事件"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                    }
                }
                //患者报告
                Rectangle{
                    color: "#ffffff"
                    width: (parent.width-8)*(1.5/20)
                    height: parent.height
                    RowLayout{
                        id:reportRow
                        anchors.centerIn:parent
                        height: parent.height
                        width: reportRow.children.length * 70 + (reportRow.children.length - 1) * reportRow.spacing
                        spacing:2
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/baogao.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "患者报告"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                    }
                }
                //波形反转
                Rectangle{
                    color: "#ffffff"
                    width: (parent.width-8)*(1.5/20)
                    height: parent.height
                    RowLayout{
                        id:reversalRow
                        anchors.centerIn:parent
                        height: parent.height
                        width: reversalRow.children.length * 70 + (reversalRow.children.length - 1) * reversalRow.spacing
                        spacing:2
                        Rectangle{
                            width: 70
                            height: parent.height
                            radius:5
                            Image {
                                height: 30
                                width: 30
                                anchors.top: parent.top
                                anchors.topMargin: 12
                                source: "qrc:/res/fanzhuan.svg"
                                anchors.horizontalCenter: parent.horizontalCenter
                            }
                            Text{
                                width: parent.width
                                height: 25
                                anchors.bottom: parent.bottom
                                anchors.bottomMargin: 0
                                font.pixelSize: 12
                                verticalAlignment: Text.AlignVCenter  // 垂直居中
                                horizontalAlignment: Text.AlignHCenter  // 水平居中
                                color:"#333333"
                                text: "波形反转"
                            }
                            MouseArea {
                                anchors.fill: parent
                                cursorShape: Qt.PointingHandCursor
                                onClicked: {
                                }
                            }
                        }
                    }
                }
            }
        }
        //主体
        Rectangle{
            color:"transparent"
            Layout.fillWidth:true
            Layout.fillHeight:true
            Loader {
                anchors.fill: parent
                anchors.margins: 5
                anchors.topMargin: 0
                id: detailsLoader
                focus: true
            }
            Component.onCompleted: {
                 Qt.callLater(function() {
                    detailsLoader.source = "ScatterPage.qml"
                });
            }
        }

    }

}

